import getopt
import sys

version = '1.0'
db ="c:\\users\ikbhal\\mycrawling\\limetorrents\\limetorrents.sqlite"
query ="SELECT count(distinct url) from limetorrents "


print 'ARGV      :', sys.argv[1:]
options, remainder = getopt.gnu_getopt(sys.argv[1:], 'd:q:', ['db=', 
                                                             'query=',
                                                             'version=',
                                                             ])
print 'OPTIONS   :', options

for opt, arg in options:
    if opt in ('-d', '--db'):
        db = arg
    elif opt in ('-q', '--query'):
        query = arg
    elif opt == '--version':
        version = arg

print 'VERSION   :', version
print 'DB    :', db
print 'QUERY    :', query
print 'REMAINING :', remainder 